﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 机器组和机器编辑.modify;

namespace 机器组和机器编辑
{
    public partial class MachineAdderForm : Form
    {
        public bool SelectedDisplay => checkBox3.Checked;  //显示
        public int SelectedId { set => textBox5.Text = value.ToString(); } //ID(仅可读)
        public string SelectedName => textBox2.Text; //机器名称
        public string SelectedNumbr => textBox1.Text; //机器编号
        public string SelectedModelNumder => comboBox1.SelectedItem?.ToString(); //机器型号_编号
        public bool SelectedOnline => checkBox3.Checked; //在线
        public string SelectedGroup => comboBox2.Text; //机器组名称
        public bool SelectedConfiguration => checkBox1.Checked;  //配置项

        public MachineAdderForm()
        {
            InitializeComponent();
        }

        private void MachineAdderForm_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e) //确定按钮点击事件
        {
            if (string.IsNullOrWhiteSpace(textBox1.Text))
            {
                MessageBox.Show("组名称不能为空", "输入错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox1.Focus();
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e) //取消按钮点击事件
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
